<?php


namespace App\Http\Controllers\Admin;


use App\Http\Controllers\Controller;
use App\Models\Game\GameGoods;
use App\Utils\ResponseUtil;

class GameGoodsController extends Controller
{

    private GameGoods $model;

    /**
     * GameGoodsController constructor.
     * @param \Illuminate\Database\Eloquent\Builder $model
     */
    public function __construct(GameGoods $model)
    {
        $this->model = $model;
    }

    public function paginate()
    {
        $perPage = request()->get('limit',20);
        $channeltype = request()->get('channeltype');
        $page = request()->get('page',1);
        $model = $this->model;
        $paginate = $model->orderByDesc('id')->where('channeltype',$channeltype)->paginate($perPage,'*','page',$page);
        return ResponseUtil::paginate($paginate);
    }

}
